<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <link type="text/css" rel="stylesheet" href="../css/all.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：员工基本信息
	更新：九哥
-->

<div class="buchongHeight"></div>

<!-----------公司员工信息1页面---------->
<div class="stepTwo" id="IstepFiveCompanyEmployeeInfoOne">
    <div class="companyHeadPanel">
        <div class="companyHeadOne" style="color:red;">*标识为必填项</div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">基本信息 <span style="color:red;">*</span></div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入姓名" class="regCode staffInfoChange"
                   id="staffName" data-class="staffName" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <span type="text" placeholder="点击选择性别" class="regCode staffInfoChange"
                  readonly id="staffSex"  data-class="staffSexName">请选择性别</span>

        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请选择出生日期" class="regCode staffInfoChange"
                   readonly id="staffBirth" data-class="staffBirthName" value="" onchange="staffInfoChange()">

        </div>
        <div class="bossInfoDiv">
            <span id="job_str_red" style="color:red;">*</span>
            <input type="text" placeholder="请选择部门和职位" class="regCode staffInfoChange"
                   readonly id="job_str" data-class="staffEduName" value="">
            <input type="hidden" id="job" value=""/>

        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入最高学历" class="regCode staffInfoChange"
                   readonly id="staffEduName" data-class="staffEduName" value="">
            <input type="hidden" id="staffEdu" data-class="staffEdu" class="staffInfoChange staffInfoChangeTwo"
                   value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入体重（公斤）" class="regCode staffInfoChange"
                   id="staffWeight" data-class="staffWeight" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入政治面貌" class="regCode staffInfoChange"
                   readonly id="staffPolityName" data-class="staffPolityName" value="">
            <input type="hidden" id="staffPolity" data-class="staffPolity" class="staffInfoChange staffInfoChangeTwo"
                   value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入籍贯" class="regCode staffInfoChange"
                   id="staffOrigin" data-class="staffOrigin" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入民族" class="regCode staffInfoChange"
                   id="staffNation" data-class="staffNation" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输选择婚姻状态" class="regCode staffInfoChange"
                   id="staffMarryName" data-class="staffMarryName" value="">
            <input type="hidden" id="staffMarry" data-class="staffMarry" class="staffInfoChange staffInfoChangeTwo"
                   value="0" onchange="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入身份证号码" class="regCode staffInfoChange"
                   id="idCard" data-class="idCard" value="" onkeyup="staffInfoChange()">
        </div>


        <p class="label_title">是否需要宿舍</p>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <select id="staffHouse" class="select" style="width:90%">
                <option value="">未知</option>
                <option value="xuyao">需要</option>
                <option value="buxuyao">不需要</option>
            </select>
        </div>


        <!--<div class="bFileDiv" id="staffXxzUrl" title="请上传形象照片" bixu="true"></div> -->
        <div class="bFileDiv" TXupfileDiv="true" id="staffXxzUrl" title="请上传形象照片" bixu="true">
            <div class="pic">
                <img class="img">
            </div>
            <p class="spantitle"><span class="red">*</span>请上传形象照片</p>
        </div>

        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入户口地址" class="regCode staffInfoChange"
                   id="houseAddress" data-class="houseAddress" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入现住地址" class="regCode staffInfoChange"
                   id="liveAddress" data-class="liveAddress" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入紧急联系人" class="regCode staffInfoChange"
                   id="contactPerson" data-class="contactPerson" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入紧急电话" class="regCode staffInfoChange"
                   id="contactMobile" data-class="contactMobile" value="" onkeyup="staffInfoChange()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="number" placeholder="请输入期望月薪" class="regCode staffInfoChange"
                   id="salary" data-class="salary" value="" onkeyup="staffInfoChange()">
        </div>
    </div>
    <div class="companyInfoSpace"></div>

    <div class="stopFloat"></div>
    <div class="companyInfoSpace"></div>
    <div class="companyRemark">备注：方便你的客户找到你、招聘的员工找到你、了解你、信任你，图片尽量上传完善。让客户多了解自己，容易接单成功。细节决定成败，图片清晰。</div>
    <div class="nextStepDiv">
        <span class="prevStep" onclick="history.go(-1)">返回</span>
        <!--<span class="nextStep" id="staffInfo1Next">下一步</span>-->
        <span class="nextStep" onclick="setSave()">保存</span>
    </div>
</div>
<!-----------公司员工信息1页面---------->


<!-----------提示信息---------->
<div id="pop">
    <div id="popMask"></div>
    <div id="popDetail">
    </div>
</div>
<!-----------提示信息---------->

<!-----------提示信息---------->
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript" src="../js/staffInfoChange.js"></script>
<script type="text/javascript" src="../js/loginStaff.js"></script>
<script src="../js/imgUpload.js"></script>
<script>
    var pany = new MC.View.format();
    var zw = new MC.View.ZhiweiDiv();
    H5.TitleBar.create('基本信息');
    (function () {
        getStaffInfo();
    })();
    $('#job_str').click(function () {
        zw.selectVal(function (val) {
            console.log(val);
            $('#job_str_red').css('color', 'rgb(86, 159, 37)');
            $('#job_str').val(val.menu + ' ' + val.erji);
            $('#job').val(val.id);
        });
    });
    var pic = new MC.View.PhotoClip();

    $('#staffXxzUrl .pic').on('click', function () {
        pic.selPic(function (imgobj) {
            //  console.log(imgobj);
            $('#staffXxzUrl').val(imgobj.img);
            $('#staffXxzUrl .pic .img').attr('src', imgobj.img);
        });
    });


    /**
     * 保存设置
     * */
    function setSave() {
        //var userInfo = cacheGet('userInfo'); //获取用户信息
        var jobType = $('#job').val();
        //获取表单
        var staffName = $('#staffName').val();
        var staffSex = $('#staffSex').val();
        var staffBirth = $('#staffBirth').val();
        var staffEdu = $('#staffEdu').val();
        var staffWeight = $('#staffWeight').val();
        var staffPolity = $('#staffPolity').val();
        var staffOrigin = $('#staffOrigin').val();
        var staffNation = $('#staffNation').val();
        var staffMarry = $('#staffMarry').val();
        var idcard = $('#idCard').val();
        var staffHouse = $('#staffHouse').val();
        var staffXxzUrl = $('#staffXxzUrl').val();
        var houseAddress = $('#houseAddress').val();
        var liveAddress = $('#liveAddress').val();
        var contactPerson = $('#contactPerson').val();
        var contactMobile = $('#contactMobile').val();
        var salary = $('#salary').val();
        var skillStr = $("#skillStr").val();
        var hobbyStr = $("#hobbyStr").val();
        if (jobType == '') {
            getErrMsg('部门和职位未选择！');
            return;
        }

        if (staffName == '') {
            getErrMsg('姓名未填写！');
            return;
        }
        if (staffSex == 0) {
            getErrMsg('性别未选择！');
            return;
        }
        if (staffBirth == '') {
            getErrMsg('出生未填写！');
            return;
        }
        if (staffEdu == 0) {
            getErrMsg('学历未填选！');
            return;
        }
        if (staffWeight == '') {
            getErrMsg('体重未填写！');
            return;
        }
        if (staffPolity == 0) {
            getErrMsg('政治面貌未填选！');
            return;
        }
        if (staffOrigin == '') {
            getErrMsg('籍贯未填写！');
            return;
        }
        if (staffNation == '') {
            getErrMsg('民族未填写！');
            return;
        }
        if (staffMarry == 0) {
            getErrMsg('婚姻貌未填选！');
            return;
        }
        if (idcard == '') {
            getErrMsg('身份证号码未填写！');
            return;
        }
        if (staffHouse == '') {
            getErrMsg('住宿未填写！');
            return;
        }
        if (!staffXxzUrl || staffXxzUrl == '') {
            getErrMsg('形象照未上传！');
            return;
        }
        if (houseAddress == '') {
            getErrMsg('户口地址未填写！');
            return;
        }
        if (liveAddress == '') {
            getErrMsg('现住地址未填写！');
            return;
        }
        if (contactPerson == '') {
            getErrMsg('紧急联系人未填写！');
            return;
        }
        if (contactMobile == '') {
            getErrMsg('紧急电话未填写！');
            return;
        }
        if (salary == '') {
            getErrMsg('期望薪资未填写！');
            return;
        }
        if (skillStr == '') {
            getErrMsg('技能未填选！');
            return;
        }
        if (hobbyStr == '') {
            getErrMsg('爱好未填选！');
            return;
        }
        var info = {
            jobType: jobType,
            job_str: $('#job_str').val(),
            realname: staffName,
            sex: staffSex,
            birth: staffBirth,
            edu: staffEdu,
            weight: staffWeight,
            polity: staffPolity,
            origin: staffOrigin,
            nation: staffNation,
            marry: staffMarry,
            idcard: idcard,
            house: staffHouse,
            xxz: staffXxzUrl,
            address: houseAddress,
            live: liveAddress,
            person: contactPerson,
            mobile: contactMobile,
            salary: salary,
            skillStr: skillStr,
            hobbyStr: hobbyStr
        };
        var data = {
            app_access: app_access,
            token: '不使用',
            /* type:userInfo.type,
             cate:userInfo.cate,*/
            staffInfos: info
        };
        cacheSet('staffInfo', ''); // 清除缓存个人信息
        $.ajax({
            type: 'post',
            url: getDomain() + 'staff/modify',
            data: data,
            success: function (res) {
                //console.log(res); return;
                if (res.code != 0) {
                    getErrMsg(res.msg);
                    return;
                }
                MC.msg.show('保存成功');
                //  window.location.href = '/h5/login/staffList.html';
            },
            error: function () {
                getErrMsg('操作失败！');
                return;
            }
        });
    }
</script>
</html>